package net.arvin.dao;

import java.util.List;

import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

public class ViewPagerAdapter extends PagerAdapter {
	private List<View> mViews;

	public ViewPagerAdapter(List<View> views) {
		this.mViews = views;
	}

	@Override
	public int getCount() {
		if (mViews != null && mViews.size() > 0) {
			return mViews.size();
		} else {
			return 0;
		}
	}

	@Override
	public Object instantiateItem(View container, int position) {
		return mViews.get(position);
	}
	
	@Override
	public boolean isViewFromObject(View view, Object obj) {
		return view == obj;
	}
	
	@Override
	public void destroyItem(ViewGroup container, int position, Object object) {
		container.removeView(mViews.get(position));
	}
}
